import pygame
import os

from pygame.locals import *

class ColoredSprite(object):
    def __init__(self, texture_location):
        self.color = (255, 255, 255)
        
        texture_path = os.path.join(texture_location[0], texture_location[1])
        self.texture = pygame.image.load(texture_path)
        self.colored_texture = self.texture
        
    def set_color(self, color):
        self.color = color
        self.colored_texture = self.texture.copy()
        self.colored_texture.fill(self.color, None, BLEND_RGBA_MULT)
    
    def get_texture(self):
        return self.colored_texture
        
    def set_texture(self, texture):
        self.texture = texture
        set_color(self.color)